<html lang="zh">
<head>
    <title>加载中</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <link rel="stylesheet" type="text/css" href="/resources/common/reset.css">
    <script type="text/javascript" src="/resources/common/wangEditor.min.js"></script>
    <script type="text/javascript" src="/resources/common/echarts.min.js"></script>
    <script type="text/javascript" src="/resources/common/jsplumb.js"></script>
    <script type="text/javascript" src="/resources/common/vue.global.prod.js"></script>
    <script type="text/javascript" src="/resources/common/dayjs.min.js"></script>
    <script type="text/javascript" src="/resources/common/zh-cn.js"></script>
    <script type="text/javascript" src="/resources/common/plugin/customParseFormat.js"></script>
    <script type="text/javascript" src="/resources/common/plugin/weekday.js"></script>
    <script type="text/javascript" src="/resources/common/plugin/localeData.js"></script>
    <script type="text/javascript" src="/resources/common/plugin/weekOfYear.js"></script>
    <script type="text/javascript" src="/resources/common/plugin/weekYear.js"></script>
    <script type="text/javascript" src="/resources/common/plugin/advancedFormat.js"></script>
    <script type="text/javascript" src="/resources/common/plugin/quarterOfYear.js"></script>
    <script type="text/javascript" src="/resources/common/axios.min.js"></script>
    <script type="text/javascript" src="/resources/common/antd-with-locales.min.js"></script>
    <script type="text/javascript" src="/resources/admin/common.js"></script>
    <script type="text/javascript" src="/page/custom.js"></script>
    <style>
        @import url(/resources/admin/icon/iconfont.css);
        @import url(/resources/admin/common.css);
        @import url(/resources/admin/style.css);
        @import url(/page/custom.css);
    </style>
</head>
<body>
<div id="app">
    <a-layout class="index-main" style="position: fixed;width: 100%;z-index: 2;">
        <a-layout-content :style="{height:'100vh'}">
            <div style="height:100vh;overflow:auto;overflow-x:hidden;" id="open_page">

            </div>
        </a-layout-content>
    </a-layout>
</div>
<script type="text/javascript">
    dayjs.locale('zh-cn');
    var app=Vue.createApp({
        data:function(){
            return {
                setting:{},
            }
        },
		mounted() {
			this.loadSystem(function(){
			    this.loadTemp("open_page",{
			        template:`<div id="index_page" :class="'index-tabspane-'+setting.theme">
                        <div style="padding:30px;"><a-skeleton /></div>
                    </div>
                    `,
                    props: ['localeZh','param','parentVue'],
                    data:function(){
                        return {theme:{},setting:{}}
                    },
		            mounted() {
                        this.isLogin(()=>{
                            let url=decodeURIComponent(mo.fn.getHash());
                            url+=(url.indexOf("?")>=0?"&":"?")+"openType=WINDOW&isOpen=true";
                            this.loadPage('index_page',url,{},function(pv,v3){
                            });
                        });
		            },
                    methods:{
                        testLogin:function(){//测试登录是否过期或session用户变化
                            this.requestData('action/manage/adminLogin/isLogin',
                                {},
                                function(data){
                                    if(data.code==0&&null!=data.model){
                                        if(data.model.oid!=mo.admin.oid){
                                            this.$warning({
                                                title:"登录人发生变化",
                                                content:"请勿在同一浏览器登录多个账号，刷新页面重新获取登录信息！",
                                                onOk:()=>{
                                                    location.reload();
                                                }
                                            });
                                        }
                                    }else{
                                        this.$warning({
                                            title:"登录失效",
                                            content:"长时间未与服务交互，登录失效，关闭页面！",
                                            onOk:()=>{
                                                window.close();
                                            }
                                        });
                                    }
                                }.bind(this),true
                            );
                        },
                        isLogin:function(fn){
                            this.requestData('action/manage/adminLogin/isLogin',
                                {},
                                function(data){
                                    mo.setting=data.setting;
                                    mo.powers=data.powers;
                                    mo.setTheme();
						            this.setting=mo.setting;
                                    if(data.code==0&&null!=data.model){
                                        mo.admin=data.model;
                                        mo.assist=data.assist||{};
                                        mo.orgGroup=data.orgGroup;
                                        if(fn) fn();
                                    }else{
                                        this.$warning({
                                            title:"登录失效",
                                            content:"长时间未与服务交互，登录失效，关闭页面！",
                                            onOk:()=>{
                                                window.close();
                                            }
                                        });
                                    }
                                }.bind(this)
                            );
                        },
                        backHandler:function(flag,obj,back){
                            window.close();
                        }
                    }
			    },{},function(pv,v3){
					window.onfocus = function() {
						pv.testLogin();
					}
					let resizeTimer=null;
					window.onresize = function() {
						if(null!=resizeTimer){
							clearTimeout(resizeTimer);
							resizeTimer=null;
						}
						resizeTimer=setTimeout(function(){
							for(let key in mo.pages){
								if(mo.pageV3s[key]['_container'].clientHeight
									&&mo.pages[key].pageFocus){
									mo.pages[key].pageFocus();
								}
							}
						},1000);
					}
			    }.bind(this));
			}.bind(this));
		},
        methods:{
            loadSystem:function(fn){
                this.requestData('action/manage/systemInfo/get',
                    {},
                    function(data){
                        if(data.code==0&&null!=data.model){
                            mo.system=data.model;
                            document.title=mo.system.backgroundTitle;
                        }
						if(fn) fn();
                    }.bind(this)
                );
            },
        }
	});
	app.mixin(mo.mixin);
	app.use(antd).use(mo.component);
	app.mount('#app');
	</script>
</body>
</html>
